// TOWN SCRIPT
//    Town 11: Isolated Hut

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documenation. States you write
// yourself should be numbered from 10-100.

begintownscript;

variables;

short i,j,choice;
short lead_char;

body;

beginstate INIT_STATE;
// This state called whenever this town is entered

set_level(6,10);
set_name(6,"Verona");
set_level(8,10);
set_name(8,"Grann");

// Regenerate NPCs
// Klinger ID = 101
// Valzier ID = 300
spawn_creature(9);
spawn_creature(10);
if (get_sdf(110,0) == 10) {
 add_char_to_party(9);
 set_flag(110,0,1);
 print_str_color("Klinger is able to rest and rejoins the party!",3);
}
if (get_sdf(110,1) == 10) {
 add_char_to_party(10);
 set_flag(110,1,1);
 print_str_color("Valzier is able to rest and rejoins the party!",3);
}
erase_char(9);
erase_char(10);

 i = 0;
 while (i < 5) {
  if (char_ok(i)) {
   lead_char = i;
   i = 5;
  }
  else
   i = i + 1;
 }

 set_crime_tolerance(1);

force_instant_terrain_redraw();
if (get_sdf(4,3) == 0) {
 set_flag(4,3,1);
 message_dialog("What a pleasant sight! You encounter a fairly large and isolated hut at the edge of this forest. The hut is surrounded by lots and lots of plants, a huge variety of them, all well tended and taken care of.","The smell of scented flowers fills the air with a mixture of pleasant aromas. You could spend hours relaxing here if you wanted.");
}

break;

beginstate EXIT_STATE;
// Always called when the town is left.
break;

beginstate START_STATE;

 if ((get_ran(1,0,100) < 7) && (get_attitude(6) == 3))
		text_bubble_on_char(6,"Welcome.");
 if ((get_ran(1,0,100) < 7) && (get_attitude(6) == 3))
		text_bubble_on_char(6,"Have some tea!");

 if ((get_ran(1,0,100) < 7) && (get_attitude(8) == 3))
		text_bubble_on_char(6,"Hi there.");
 if ((get_ran(1,0,100) < 7) && (get_attitude(8) == 3))
		text_bubble_on_char(6,"Have a nice day!");

break;


beginstate 10;

if ((get_sdf(4,5) == 0) && (get_attitude(8) == 3)) {
 set_flag(4,5,1);
 message_dialog("You enter a small cramped room filled with plants. Plants are everywhere! On the floor in pots and urns, on the walls, and even hanging from the ceiling! The owner must really enjoy them to have so many.","You jump in surprise when a wolf approaches you! At first you are afraid, but then it says, _Oh, sorry I startled you. I watch over this place._ The wolf quietly wanders off. Must be a familiar.");
}

break;


beginstate 11;

if ((get_sdf(4,6) == 0) && (get_attitude(6) == 3)) {
 set_flag(4,6,1);
 message_dialog("You enter a large study filled with plants all over. Different varieties of pretty flowers and all sorts of herbs decorate the walls and hang from the ceiling. An old woman Nephil sits at the table and smiles.","_Greetings, strangers. I am called Verona._ she says welcomingly. _Would you like some tea?_ You tell her perhaps later. She smiles, _Well, make yourself at home and enjoy my beautiful flowers._");
}

break;


beginstate 12;

if (get_sdf(4,7) == 0) {
 set_flag(4,7,1);
 message_dialog("My gods! Verona even has plants cluttering her kitchen. These appear to be herbs meant for spices, teas, garnishes, and other sorts of cooking applications. A pungent smell of ginger fills the air here.","");
}

break;


beginstate 13;

if (get_sdf(4,8) == 0) {
 set_flag(4,8,1);
 message_dialog("This must be where Verona does her alchemy. You can tell by the smell of boiling alchemicals coming from the cauldrons to the east. By now she is probably the expert on the native herbs of this forest.","");
}

break;


beginstate 14;

if (get_sdf(4,9) == 0) {
 set_flag(4,9,1);
 message_dialog("You turn the corner and jump back, startled. Before you is a giant fungus creature, usually very dangerous. Fortunately, you realize that it is constrained by a holding rune.","You should be fine, as long as you do not get too close.");
}

break;